<?php

class ControleEndereco {
		
	public function cadastrar(Endereco $endereco) {
		
		include("../conexao/config.php");
		$conexao = new Config();
		
		$query = "insert into endereco values(NULL, ?, ?, ?, ?, ?)";
		
		$stmt = $conexao->conectar()->prepare($query);
		
		$stmt->bindValue(1, $endereco->getLogradouro());
		$stmt->bindValue(2, $endereco->getBairro());
		$stmt->bindValue(3, $endereco->getCidade());
		$stmt->bindValue(4, $endereco->getEstado());
		$stmt->bindValue(5, $endereco->getCep());
		
		$stmt->execute();
	}
	
	public function alterar($id, $descricao) {
		$this->$id = $id;
		$this->$descricao = $descricao;
		
		include("../conexao/config.php");
		$conexao = new Config();
		
		$query = "update tipo_imovel set nome_tipo = ? where id_tipo = ?";
		
		$stmt = $conexao->conectar()->prepare($query);
		
		$stmt->bindValue(1, $descricao);		
		$stmt->bindValue(2, $id);
		
		$stmt->execute();
				
	}

}

?>